<link rel="stylesheet" href="/assets/css/m.css"/>
<div class="tpl-portlet-components" xmlns:th="http://www.thymeleaf.org">
    <div class="portlet-title">
        <div class="caption font-green bold">
            保存管理员
        </div>
        <div class="tpl-portlet-input tpl-fz-ml">
            <div class="portlet-input input-small input-inline">
                <div class="input-icon right">
                    <i class="am-icon-search"></i>
                    <input type="text" class="form-control form-control-solid" placeholder="搜索..."></div>
            </div>
        </div>
    </div>
    <div class="tpl-block ">
        <div class="am-g tpl-amazeui-form">
            <div class="am-u-sm-12 am-u-md-9">
                <form class="am-form am-form-horizontal" name="adminForm" id="add_admin_form">
                    <input type="hidden" name="id" th:value="${admin==null?'':admin.id}" id="adminId">
                    <div class="am-form-group">
                        <label for="nickname" class="am-u-sm-3 am-form-label">昵称 / Nickname</label>
                        <div class="am-u-sm-9">
                            <input type="text" name="nickname" id="nickname" placeholder="用户昵称"
                                   th:value="${admin == null? 'jack' : admin.nickname}">
                            <small>给自己起一个独特的昵称吧</small>
                        </div>
                    </div>
                    <div class="am-form-group">
                        <label for="Account" class="am-u-sm-3 am-form-label">帐号 / Account</label>
                        <div class="am-u-sm-9">
                            <input type="text" name="account" id="account" placeholder="请输入登录帐号"
                                   th:value="${admin == null? 'admin' : admin.account}"
                                   onchange="checkAccountIsExist()"/>
                            <small>用来登录后台的帐号</small>
                            <div class="span-exist-tip"><span class="label label-sm label-danger">帐号已经存在!</span>
                            </div>
                        </div>

                    </div>
                    <div class="am-form-group">
                        <input hidden="hidden" id="raw-password" th:value="${admin==null?'':admin.password}">
                        <label for="Password" class="am-u-sm-3 am-form-label">密码 / Password</label>
                        <div class="am-u-sm-9">
                            <input type="password" id="password" required="required" placeholder="请输入密码"
                                   th:value="${admin == null? 'admin' : admin.password}">
                            <small>用来登录后台的密码</small>
                        </div>
                    </div>
                    <div class="am-form-group">
                        <label class="am-u-sm-3 am-form-label">角色 / Role
                            <span class="tpl-form-line-small-title"></span></label>
                        <div class="am-u-sm-9">
                            <select data-am-selected="{searchBox: 1}" name="role">
                                <option th:each="role :${roleList}"
                                        th:text="${role.name}"
                                        th:value="${role.id}"
                                        th:selected="${admin==null?false:role.id == admin.role.id}"></option>
                            </select>
                        </div>
                    </div>
                    <div class="am-form-group">
                        <label for="gender" class="am-u-sm-3 am-form-label">性别 / Gender</label>
                        <div class="am-u-sm-9">
                            男&nbsp;<input name="gender" type="radio" id="gender" value="男" checked>
                            女&nbsp;<input name="gender" type="radio" value="女">
                        </div>
                    </div>
                    <div class="am-form-group">
                        <label for="birthday" class="am-u-sm-3 am-form-label">出生日期 / Birthday</label>
                        <div class="am-u-sm-9">
                            <input type="date" name="birthday" id="birthday" placeholder="请填写出生日期"
                                   th:value="${admin == null ? '2018-02-05': #dates.format(admin.birthday,'yyyy-MM-dd')}">
                            <small>填写一下自己的出生日期吧</small>
                        </div>
                    </div>
                    <div class="am-form-group">
                        <div class="am-u-sm-9 am-u-sm-push-3">
                            <button type="button" onclick="saveAdmin()" class="am-btn am-btn-primary">保存管理员</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

</div>
